﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HlgSiemensCommunication
{
    public class InputSiemensParams
    {
        public string DB { get; set; }

        /// <summary>
        /// 字符串长度
        /// </summary>
        public int Length { get; set; }

        public SiemensDataType ItemType { get; set; }

        public object WriteValue { get; set; }

        public DBtype DBtype { get; set; } = DBtype.DB;
    }

    public class OutputSiemensParams
    {
        public string DB { get; set; }

        public SiemensDataType ItemType { get; set; }

        public object Result { get; set; }
    }

    public class SiemensParams
    {
        public string DB { get; set; }

        /// <summary>
        /// 数据长度 主要写
        /// </summary>
        public int Length { get; set; }

        /// <summary>
        /// DB 16进制
        /// </summary>
        public int VirtaulDB { get; set; }

        /// <summary>
        /// DB偏移量 位
        /// </summary>
        public int VirtualOffSet { get; set; }

        public SiemensDataType ItemType { get; set; }
        /// <summary>
        /// 返回值
        /// </summary>
        public object Result { get; set; }

        /// <summary>
        /// 要写入的Data总长度
        /// </summary>
        public int WriteLength { get; internal set; }

        /// <summary>
        /// 要填充的Full byte
        /// </summary>
        public int FullByte { get; internal set; } = 0;

        public DBtype DBtype { get; set; } = DBtype.DB;
    }

    /// <summary>
    /// 数据类型
    /// </summary>
    public enum SiemensDataType
    {
        Bool,
        Float,
        String,
        Uint16,
        Int16,
        Byte,
        StringArray

    }

    public enum SiemensTypeS
    {
        S1200 = 1,
        S300 = 2,
        S400 = 3,
        S1500 = 4,
        S200Smart = 5,
    }

    public enum DBtype
    {
        DB,
        I,
        Q,
        M,
    }
}
